package com.huijinhui.wlmtsys.controller;


import com.huijinhui.wlmtsys.constant.JwtClaimsConstant;
import com.huijinhui.wlmtsys.pojo.dtos.*;
import com.huijinhui.wlmtsys.pojo.entity.User;
import com.huijinhui.wlmtsys.pojo.vo.UserLoginVO;
import com.huijinhui.wlmtsys.properties.JwtProperties;
import com.huijinhui.wlmtsys.service.ArticleService;
import com.huijinhui.wlmtsys.service.UserService;
import com.huijinhui.wlmtsys.utils.JwtUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@Tag(name = "文章相关接口")
@RestController
@RequestMapping("/article")
@RequiredArgsConstructor
@Slf4j
public class ArticleController {


    final ArticleService articleService;


    @Operation(summary = "用户点赞或取消点赞·接口")
    @PostMapping("/like")
    public ResponseResult like(@RequestBody LikesBehaviorDto dto) {
        return articleService.like(dto);
    }

    @Operation(summary = "用户阅读文章·接口")
    @PostMapping("/read")
    public ResponseResult read(@RequestBody ReadBehaviorDto dto) {
        return articleService.read(dto);
    }

    @Operation(summary = "用户收藏或取消收藏·接口")
    @PostMapping("/collect")
    public ResponseResult collect(@RequestBody CollectionBehaviorDto dto) {
        return articleService.collect(dto);
    }


}
